﻿#include "DownloadFileResultCmd.h"

DownloadFileResultCmd::DownloadFileResultCmd(QObject *parent) :
    BaseCmd(parent)
{
    this->m_protocolType = ProtocolType::CloudProtocol;
    this->m_functionCode = FunctionCode;
    this->m_result = 0;
}

Package DownloadFileResultCmd::toPackage()
{
    Package package;
    QByteArray body;

    body.append(DataTypeConver::intToByteArray(m_result,1));

    body = encrypt(body,KeyType::AES);

    package.setId(m_cmdId);
    package.setFunction(FunctionCode);
    package.setBody(body);

    return package;
}

void DownloadFileResultCmd::unPackage(Package package)
{
    m_cmdId = package.id();
}

int DownloadFileResultCmd::result() const
{
    return m_result;
}

void DownloadFileResultCmd::setResult(int result)
{
    m_result = result;
}
